/* ------------------------------------------------------------------------- *
 *                                SPHinXsys                                  *
 * ------------------------------------------------------------------------- *
 * SPHinXsys (pronunciation: s'finksis) is an acronym from Smoothed Particle *
 * Hydrodynamics for industrial compleX systems. It provides C++ APIs for    *
 * physical accurate simulation and aims to model coupled industrial dynamic *
 * systems including fluid, solid, multi-body dynamics and beyond with SPH   *
 * (smoothed particle hydrodynamics), a meshless computational method using  *
 * particle discretization.                                                  *
 *                                                                           *
 * SPHinXsys is partially funded by German Research Foundation               *
 * (Deutsche Forschungsgemeinschaft) DFG HU1527/6-1, HU1527/10-1,            *
 *  HU1527/12-1 and HU1527/12-4.                                             *
 *                                                                           *
 * Portions copyright (c) 2017-2025 Technical University of Munich and       *
 * the authors' affiliations.                                                *
 *                                                                           *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may   *
 * not use this file except in compliance with the License. You may obtain a *
 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.        *
 *                                                                           *
 * ------------------------------------------------------------------------- */
/**
 * @file 	execution_policy.h
 * @brief 	Here we define the execution policy relevant to parallel computing.
 * @details This analog of the standard library on the same functions.
 * @author	Xiangyu Hu and  Fabien Pean
 */

#ifndef EXECUTION_POLICY_H
#define EXECUTION_POLICY_H

namespace SPH
{
namespace execution
{
class SequencedPolicy
{
};

class UnsequencedPolicy
{
};

class ParallelPolicy
{
};

class ParallelUnsequencedPolicy
{
};

template <typename...>
class DeviceExecution;

template <>
class DeviceExecution<>
{
};

template <typename PolicyType>
class DeviceExecution<PolicyType>
    : public DeviceExecution<>, public PolicyType
{
};

using ParallelDevicePolicy = DeviceExecution<ParallelPolicy>;
using SequencedDevicePolicy = DeviceExecution<SequencedPolicy>;

inline constexpr auto seq = SequencedPolicy{};
inline constexpr auto unseq = UnsequencedPolicy{};
inline constexpr auto par_host = ParallelPolicy{};
inline constexpr auto par_unseq = ParallelUnsequencedPolicy{};
inline constexpr auto par_device = ParallelDevicePolicy{};
inline constexpr auto seq_device = SequencedDevicePolicy{};

#if SPHINXSYS_USE_SYCL
using MainExecutionPolicy = ParallelDevicePolicy;
inline constexpr auto par_ck = ParallelDevicePolicy{};
#else
using MainExecutionPolicy = ParallelPolicy;
inline constexpr auto par_ck = ParallelPolicy{};
#endif // SPHINXSYS_USE_SYCL

} // namespace execution
} // namespace SPH
#endif // EXECUTION_POLICY_H
